package cn.beatuty.makeup.module.system.dal.mysql.follow;

import java.util.*;

import cn.beatuty.makeup.framework.common.pojo.PageResult;
import cn.beatuty.makeup.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.beatuty.makeup.framework.mybatis.core.mapper.BaseMapperX;
import cn.beatuty.makeup.module.system.controller.admin.follow.vo.FollowPageReqVO;
import cn.beatuty.makeup.module.system.dal.dataobject.follow.FollowDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 用户关注关系 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface FollowMapper extends BaseMapperX<FollowDO> {

    default PageResult<FollowDO> selectPage(FollowPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<FollowDO>()
                .eqIfPresent(FollowDO::getUserId, reqVO.getUserId())
                .eqIfPresent(FollowDO::getAuthorId, reqVO.getAuthorId())
                .eqIfPresent(FollowDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(FollowDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(FollowDO::getId));
    }

}